<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('category_id')->comment('分类ID')->default(0);
            $table->integer('user_id')->comment('发布用户ID')->default(0);
            $table->integer('check_id')->comment('用户检查审核ID')->default(0);
            $table->integer('rank')->comment('排序')->default(0);
            $table->integer('liked')->comment('喜欢人数')->default(0);
            $table->integer('commented')->comment('评论数')->default(0);
            $table->integer('pageview')->comment('展现次数')->default(0);
            $table->text('body')->comment('内容');
            $table->text('images')->comment('图片组')->nullable();
            $table->string('video',1024)->comment('视频地址')->nullable();// 如果有视频地址，则为视频类型内容
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}
